<template>
  <el-dialog
    :title="title"
    custom-class="c-dialog"
    :visible="delVisible"
    @close="onClose"
    width="30%">
    <div class="dialog-cont">
      <p class="dialog-tip">{{ delCont }}</p>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button class="c-btn" type="primary" @click="handleDel">确 定</el-button>
      <el-button class="c-btn" @click="onClose">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: 'delConfim',
  props: {
    delVisible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: '删除提示'
    },
    delCont: {
      type: String,
      default: '您确定要删除吗？删除之后无法恢复。'
    }
  },
  methods: {
    onClose () {
      if (this.delVisible) {
        this.$emit('update:delVisible', false)
      }
    },
    handleDel () {
      this.onClose()
      this.$emit('handleDelete', this.id)
    }
  }
}
</script>
